package day03;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

//运算符的演示
public class OperDemo {
    public static void main(String[] args) {
       /*
        int a=5,b=5;
        a++;//相当于a=a+1
        ++b;//相当于b=b+1
        System.out.println(a);//6
        System.out.println(b);//6
        */
        /*
        //a++的值为a,++a的值为a+1
        int a = 5,b = 5;
        int c = a++;//将a++的值5赋值给c,同时a自增1变为6
        int d = ++b;//将++b的值6赋值给d,同时b自增1变为6
        System.out.println(a);//6
        System.out.println(b);//6
        System.out.println(c);//5
        System.out.println(d);//6
        */
        /*
        int a1 = 5,b1 = 5;
        int c1 = a1--;
        int d1 = --b1;
        System.out.println(a1);//4
        System.out.println(b1);//4
        System.out.println(c1);//5
        System.out.println(d1);//4
        */
        /*int a=2,b=8;
        int c = a++;
        int d = --b;
        System.out.println(a);//3
        System.out.println(b);//7
        System.out.println(c);//2
        System.out.println(d);//7
        /*
        //2)关系运算符
        int a= 5,b=10,c=5;
        boolean b1 = a>c;
        System.out.println(b1);//false
        System.out.println(c<b);//true
        System.out.println(a>=c);//true
        System.out.println(a<=b);//true
        System.out.println(a==c);//true
        System.out.println(a!=c);//false
        System.out.println(a%2==0);//false
        System.out.println(a+c>b);//false
        System.out.println(a++>5);//false
        System.out.println(a++>5);//true
        System.out.println(a++);//7
        */
        /*
        //3)逻辑运算符
        int f=5,g=10,h=5;
        boolean g1 = g>=f && g<h;
        System.out.println(g1);//false
        System.out.println(g<=h && g>f);//false
        System.out.println(f==h && h>g);//false
        System.out.println(g!=h && f<g);//true
        System.out.println(f>=g || g>h);//true
        System.out.println(f<= g || f==h);//true
        System.out.println(f>g || f!=h);//false
        System.out.println(f++==h && f++>g);//false
        System.out.println(f++);//7

        int age = 18;
        System.out.println(age>=1&&age<=30);//年龄在1到30之间
        int score = 88;
        System.out.println(score>=0 && score<=100);//成绩在0到100之间
        boolean g2 = !(f<g);
        System.out.println(g2);//false
        System.out.println(!(g>h));//false
        System.out.println(!(h>g));//true
        System.out.println(!(f++ >= h));//false
        */

        //5).字符串连接运算符:+
        int age = 29;
        String name = "YHY";
        String gender = "女";
        System.out.println("大家好,我叫"+name+",性别"+gender+",今年"+age+"岁了");

        System.out.println(10+20+"+30");//3030---------String
        System.out.println(""+10+20+30);//102030-------String
        System.out.println(10+20+30+"");//60-----------String

        //6)条件/三木运算符: boolean?数1:数2
        int num = 5;
        int flag = num>0?1:-1;
        System.out.println(flag);//1

        int a=8,b=55;
        int max = a>b?a:b;
        System.out.println("max="+max);//55




    }

}
